package cn.itzzx.lagou.blog.service.impl;

import cn.itzzx.lagou.blog.mapper.ArticleMapper;
import cn.itzzx.lagou.blog.pojo.Article;
import cn.itzzx.lagou.blog.service.ArticleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * TODO
 *
 * @author Martin
 * @since 1.0
 */
@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public PageInfo<Article> listArticle(Integer page, Integer rows) {
        PageHelper.startPage(page,rows);
        List<Article> articles = articleMapper.listArticle();
        PageInfo<Article> pageInfo = new PageInfo<>(articles);
        return pageInfo;
    }

}
